<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:in="http://java.sun.com/jsf/composite/inward"
                xmlns:bi="http://java.sun.com/jsf/composite/inward/bill"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:credit="http://java.sun.com/jsf/composite/inward/creditCompany">



    <ui:define name="content" >

        <h:panelGroup >
            <h:form  >
                <p:panel rendered="#{!bhtSummeryController.printPreview}" >
                    <f:facet name="header" >
                        <h:panelGrid columns="15"  >
                            <h:outputLabel value="Inward Final Bill" />    
                            <p:commandButton update="dList tot" value="Refresh" style="float: right;"
                                             actionListener="#{bhtSummeryController.updateTotal()}" 
                                             onclick="onSubmitButton();"/>
                            <p:commandButton  value="Settle" action="#{bhtSummeryController.settle}" 
                                              id="settle"
                                              ajax="false"
                                              disabled="#{bhtSummeryController.changed}"
                                              style="width: 150px; padding: 1px;border: 1px solid ; margin: auto;" onclick="onSubmitButton();">

                            </p:commandButton>
                        </h:panelGrid>
                    </f:facet>       

                    <h:panelGrid columns="3">
                        <h:panelGroup id="panSearch2">
                            <in:bhtDetail admission="#{bhtSummeryController.patientEncounter}"/>
                        </h:panelGroup>  
                        <h:panelGroup>
                            <h:panelGroup id="crd" rendered="#{bhtSummeryController.patientEncounter.paymentMethod eq 'Credit'}">
                                <credit:outputCredit  patientEncounter="#{bhtSummeryController.patientEncounter}"/>
                            </h:panelGroup>
                            <p:panelGrid columns="2" id="tot" style="min-width: 100%;">
                                <h:outputLabel  value="Total Charges" style="font-weight: bold"/>
                                <h:outputLabel value="#{bhtSummeryController.grantTotal}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                                <h:outputLabel value="Discount" style="font-weight: bold"/>
                                <h:outputLabel  value="#{bhtSummeryController.discount}" >
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                                <h:outputLabel value="Net Charges" style="font-weight: bold"/>
                                <h:outputLabel  value="#{bhtSummeryController.grantTotal-bhtSummeryController.discount}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                                <h:outputLabel value="Paid " style="font-weight: bold"/>
                                <h:outputLabel value="#{bhtSummeryController.paid}">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                                <h:outputLabel value="Due " style="font-weight: bold"
                                               rendered="#{bhtSummeryController.patientEncounter.paymentMethod ne 'Credit' 
                                                           and bhtSummeryController.due > 0 }"/>
                                <h:outputLabel value="#{bhtSummeryController.due}"
                                               rendered="#{bhtSummeryController.patientEncounter.paymentMethod ne 'Credit' 
                                                           and bhtSummeryController.due > 0 }">
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                                <h:outputLabel value="Adjusted Total " style="font-weight: bold" />
                                <h:outputLabel id="claim" value="#{bhtSummeryController.adjustedTotal}" >
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                                <h:outputLabel value="Different With Actual and Adjusted " style="font-weight: bold" />
                                <h:outputLabel value="#{bhtSummeryController.grantTotal-bhtSummeryController.adjustedTotal}" >
                                    <f:convertNumber pattern="#,##0.00" />
                                </h:outputLabel>
                            </p:panelGrid>      
                        </h:panelGroup>
                        <h:panelGrid columns="2">
                            <h:outputLabel value="Printing Admission Time"/>
                            <p:calendar value="#{bhtSummeryController.patientEncounter.printingAdmissionTime}" 
                                        id="printingAdmissionTimeStamp"
                                        pattern="dd/MMM/yyyy - hh:mm:ss a" >                               
                            </p:calendar>     
                            <h:outputLabel value="Printing Discharge Time"/>
                            <p:calendar value="#{bhtSummeryController.patientEncounter.printingDischargeTime}"
                                        id="printingDischargeTimeStamp"
                                        pattern="dd/MMM/yyyy - hh:mm:ss a" >                               
                            </p:calendar>    
                        </h:panelGrid>
                    </h:panelGrid>

                    <p:dataTable id="dList" value="#{bhtSummeryController.chargeItemTotals}" var="c" scrollable="true" scrollHeight="300">
                        <p:column headerText="Inward Charge Type" >
                            <h:outputLabel  value="#{c.inwardChargeType.label}"  />
                        </p:column>
                        <p:column headerText="Total">
                            <h:outputLabel value="#{c.total}" >
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>                            
                        </p:column>
                        <p:column headerText="Discount">
                            <p:inputText autocomplete="off" id="catDiscount" value="#{c.discount}"  disabled="#{c.inwardChargeType eq 'RoomCharges' 
                                                                                      or c.inwardChargeType eq 'MOCharges'
                                                                                      or c.inwardChargeType eq 'MaintainCharges'
                                                                                      or c.inwardChargeType eq 'NursingCharges'
                                                                                      or c.inwardChargeType eq 'LinenCharges'
                                                                                      or c.inwardChargeType eq 'MedicalCareICU'
                                                                                      or c.inwardChargeType eq 'AdministrationCharge'
                                                                                      or c.inwardChargeType eq 'ProfessionalCharge'
                                                                                      or c.inwardChargeType eq 'MedicalCare' 
                                                                                      or c.total eq 0}" >
                                <f:convertNumber pattern="#,##0.00" />
                                <p:ajax process="@this" update="@this catNetTotal :#{p:component('tot')}  "  event="blur"
                                        listener="#{bhtSummeryController.changeDiscountListener(c)}"/>
                                <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}"
                                        listener="#{bhtSummeryController.changeIsMade()}"/>
                            </p:inputText>
                        </p:column>
                        <p:column headerText="NetTotal">
                            <h:outputLabel id="catNetTotal" value="#{c.netTotal}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column>
                        <p:column >
                            <p:inputText autocomplete="off" id="catAdj" value="#{c.adjustedTotal}" 
                                         disabled="#{c.inwardChargeType eq 'RoomCharges' 
                                                     or c.inwardChargeType eq 'MOCharges'
                                                     or c.inwardChargeType eq 'MaintainCharges'
                                                     or c.inwardChargeType eq 'NursingCharges'
                                                     or c.inwardChargeType eq 'LinenCharges'
                                                     or c.inwardChargeType eq 'MedicalCareICU'
                                                     or c.inwardChargeType eq 'AdministrationCharge'
                                                     or c.inwardChargeType eq 'ProfessionalCharge'}">
                                <f:convertNumber pattern="#,##0.00" />
                                <p:ajax process="@this" update=":#{p:component('tot')} "  event="blur"
                                        listener="#{bhtSummeryController.updateTotal()}"/>
                                <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                            </p:inputText>
                        </p:column>
                    </p:dataTable>  

                    <p:spacer height="100"/>



                    <p:tabView id="tabView">

                        <p:tab title="Room Name">
                            <p:dataTable var="b" value="#{bhtSummeryController.patientRooms}" >                                  
                                <p:column headerText="Actual Room">
                                    <h:outputLabel value="#{b.roomFacilityCharge.name}" />                                
                                </p:column>      
                                <p:column headerText="Printing Room">
                                    <p:autoComplete converter="fac" forceSelection="true"
                                                    value="#{b.printRoomFacilityCharge}" 
                                                    completeMethod="#{roomFacilityChargeController.completeRoomChargeAll}"
                                                    var="rf" itemLabel="#{rf.name}" itemValue="#{rf}"     >
                                        <p:ajax event="itemSelect" process="@this" listener="#{patientRoomController.edit(b)}"/>
                                    </p:autoComplete>                                        
                                </p:column>                                                                          
                                <p:column headerText="AdmittedAt">
                                    <p:calendar navigator="true"  
                                                id="printingRoomAdmittedTimeStamp"
                                                value="#{b.printAdmittedAt}" 
                                                pattern="dd/MMM/yyyy - hh:mm:ss a" >
                                        <p:ajax event="change" process="@this" listener="#{patientRoomController.edit(b)}"/>
                                    </p:calendar>
                                </p:column>
                                <p:column headerText="DischargeAt" >                                      
                                    <p:calendar navigator="true"  
                                                id="printingRoomDischargeTimeStamp"
                                                value="#{b.printDischargeAt}" 
                                                pattern="dd/MMM/yyyy - hh:mm:ss a" >
                                        <p:ajax event="change" process="@this" listener="#{patientRoomController.edit(b)}"/>
                                    </p:calendar>

                                </p:column>                   
                            </p:dataTable>
                        </p:tab>

                        <p:tab title="Room Charge">
                            <p:dataTable var="b" value="#{bhtSummeryController.patientRooms}">   

                                <p:column headerText="Actual Room">
                                    <h:outputLabel value="#{b.roomFacilityCharge.name}" />                                
                                </p:column> 
                                <p:column headerText="Calculated" >                                      
                                    <p:outputLabel value="#{b.calculatedRoomCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column  headerText="Discount">                                      
                                    <p:inputText autocomplete="off" value="#{b.discountRoomCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />                                           
                                        <p:ajax event="blur" process="@this"  update="chargeNet" 
                                                listener="#{bhtSummeryController.changeDiscountListenerPatientRoomRoomCharge(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                                <p:column headerText="Net" >                                      
                                    <p:outputLabel id="chargeNet" value="#{b.calculatedRoomCharge-b.discountRoomCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Adjusted">                                      
                                    <p:inputText autocomplete="off" id="chargeAdj" value="#{b.adjustedRoomCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />                                        
                                        <p:ajax event="blur" process="@this" 
                                                listener="#{bhtSummeryController.changeAdjustedValueRoomCharge(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                        <p:tab title="Maintain Charge">
                            <p:dataTable var="b" value="#{bhtSummeryController.patientRooms}">   
                                <p:column headerText="Actual Room">
                                    <h:outputLabel value="#{b.roomFacilityCharge.name}" />                                
                                </p:column> 
                                <p:column headerText="Calculated">                                      
                                    <p:outputLabel value="#{b.calculatedMaintainCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Discount" >
                                    <p:inputText autocomplete="off" value="#{b.discountMaintainCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />                                        
                                        <p:ajax event="blur" process="@this" update="mainNet"
                                                listener="#{bhtSummeryController.changeDiscountListenerPatientRoomMaintain(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                                <p:column headerText="Net" >                                      
                                    <p:outputLabel id="mainNet" value="#{b.calculatedMaintainCharge-b.discountMaintainCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Adjusted" >                                      
                                    <p:inputText autocomplete="off" id="mainAdj" value="#{b.adjustedMaintainCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />                                           
                                        <p:ajax event="blur" process="@this" 
                                                listener="#{bhtSummeryController.changeAdjustedValueMaintain(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>

                            </p:dataTable>
                        </p:tab>

                        <p:tab title="MO Charge">
                            <p:dataTable  var="b" value="#{bhtSummeryController.patientRooms}">                                  
                                <p:column headerText="Actual Room">
                                    <h:outputLabel value="#{b.roomFacilityCharge.name}" />                                
                                </p:column> 
                                <p:column headerText="Calculated" >                                      
                                    <p:outputLabel value="#{b.calculatedMoCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Discount" >                                      
                                    <p:inputText autocomplete="off" value="#{b.discountMoCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />                                          
                                        <p:ajax event="blur" process="@this"  update="moNet"
                                                listener="#{bhtSummeryController.changeDiscountListenerPatientRoomMo(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                                <p:column headerText="Net" >                                      
                                    <p:outputLabel id="moNet" value="#{b.calculatedMoCharge-b.discountMoCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Adjusted" >                                      
                                    <p:inputText autocomplete="off" id="moAdj" value="#{b.adjustedMoCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />        

                                        <p:ajax event="blur" process="@this" 
                                                listener="#{bhtSummeryController.changeAdjustedValueMo(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                            </p:dataTable>

                        </p:tab>

                        <p:tab title="Nursing Charge">
                            <p:dataTable var="b" value="#{bhtSummeryController.patientRooms}">   

                                <p:column headerText="Actual Room">
                                    <h:outputLabel value="#{b.roomFacilityCharge.name}" />                                
                                </p:column> 
                                <p:column headerText="Calculated">                                      
                                    <p:outputLabel value="#{b.calculatedNursingCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Discount" >                                      
                                    <p:inputText autocomplete="off" value="#{b.discountNursingCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />     

                                        <p:ajax event="blur" process="@this"  update="nurNet" 
                                                listener="#{bhtSummeryController.changeDiscountListenerPatientRoomNursing(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                                <p:column headerText="Net" >                                      
                                    <p:outputLabel id="nurNet" value="#{b.calculatedNursingCharge-b.discountNursingCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Adjusted">                                      
                                    <p:inputText autocomplete="off" id="nurAdj" value="#{b.ajdustedNursingCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />    

                                        <p:ajax event="blur" process="@this"
                                                listener="#{bhtSummeryController.changeAdjustedValueNursing(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                        <p:tab title="Administration Charge">
                            <p:dataTable var="b" value="#{bhtSummeryController.patientRooms}">   

                                <p:column headerText="Actual Room">
                                    <h:outputLabel value="#{b.roomFacilityCharge.name}" />                                
                                </p:column> 
                                <p:column headerText="Calculated">                                      
                                    <p:outputLabel value="#{b.calculatedAdministrationCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column  headerText="Discount" >                                      
                                    <p:inputText autocomplete="off" value="#{b.discountAdministrationCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />     

                                        <p:ajax event="blur" process="@this"  update="admNet" 
                                                listener="#{bhtSummeryController.changeDiscountListenerPatientRoomAdministration(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                                <p:column headerText="Net" >                                      
                                    <p:outputLabel id="admNet" value="#{b.calculatedAdministrationCharge-b.discountAdministrationCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Adjusted">                                      
                                    <p:inputText autocomplete="off" id="admAdj" value="#{b.ajdustedAdministrationCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />   

                                        <p:ajax event="blur" process="@this" listener="#{bhtSummeryController.changeAdjustedValueAdministration(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                        <p:tab title="Madicare Care Charge">
                            <p:dataTable var="b" value="#{bhtSummeryController.patientRooms}">                         
                                <p:column headerText="Actual Room">
                                    <h:outputLabel value="#{b.roomFacilityCharge.name}" />                                
                                </p:column> 
                                <p:column headerText="Calculated">                                      
                                    <p:outputLabel value="#{b.calculatedMedicalCareCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Discount" >                                      
                                    <p:inputText autocomplete="off" value="#{b.discountMedicalCareCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />

                                        <p:ajax event="blur" process="@this"  update="medNet" 
                                                listener="#{bhtSummeryController.changeDiscountListenerPatientRoomMedicalCare(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                                <p:column headerText="Net" >                                      
                                    <p:outputLabel id="medNet" value="#{b.calculatedMedicalCareCharge-b.discountMedicalCareCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Adjusted">                                      
                                    <p:inputText autocomplete="off" id="medAdj" value="#{b.ajdustedMedicalCareCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />   

                                        <p:ajax event="blur" process="@this"  listener="#{bhtSummeryController.changeAdjustedValueMedicalCare(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                            </p:dataTable>
                        </p:tab>

                        <p:tab title="Linen Charge">
                            <p:dataTable var="b" value="#{bhtSummeryController.patientRooms}">   

                                <p:column headerText="Actual Room">
                                    <h:outputLabel value="#{b.roomFacilityCharge.name}" />                                
                                </p:column> 
                                <p:column headerText="Calculated">                                      
                                    <p:outputLabel value="#{b.calculatedLinenCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Discount" >                                      
                                    <p:inputText autocomplete="off" value="#{b.discountLinenCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />

                                        <p:ajax event="blur" process="@this"  update="linNet"
                                                listener="#{bhtSummeryController.changeDiscountListenerPatientRoomLinen(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                                <p:column headerText="Net" >                                      
                                    <p:outputLabel id="linNet" value="#{b.calculatedLinenCharge-b.discountLinenCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="Adjusted">                                      
                                    <p:inputText autocomplete="off" id="linAdj" value="#{b.ajdustedLinenCharge}" >
                                        <f:convertNumber pattern="#,##0.00" />                                             
                                        <p:ajax event="blur" process="@this"  listener="#{bhtSummeryController.changeAdjustedValueLinen(b)}"/>
                                        <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                                    </p:inputText>
                                </p:column>
                            </p:dataTable>
                        </p:tab>
                    </p:tabView>

                    <p:dataTable value="#{bhtSummeryController.profesionallFee}" var="pf"
                                 rowStyleClass="#{pf.feeValue ne 0 
                                                  and pf.bill.cancelled eq false
                                                  and pf.bill.billClass eq 'class com.divudi.entity.BilledBill' ? '':'noDisplayRow'}">
                        <p:column headerText="Name">
                            #{pf.staff.person.nameWithTitle}
                        </p:column>
                        <p:column headerText="Fee Value" style="text-align: right;">
                            <h:outputLabel value="#{pf.feeValue}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                        </p:column>
                        <p:column headerText="Adjusted Value" style="text-align: right;">
                            <p:inputText autocomplete="off" value="#{pf.feeAdjusted}">
                                <f:convertNumber pattern="#,##0.00"/>                               
                                <p:ajax event="blur" process="@this" 
                                        update=":#{p:component('dList')} :#{p:component('tot')}"  
                                        listener="#{bhtSummeryController.changeAdjustedProValue(pf)}"/>
                                <p:ajax process="@this" event="keyup" update=":#{p:component('settle')}" listener="#{bhtSummeryController.changeIsMade()}"/>
                            </p:inputText>
                        </p:column>

                    </p:dataTable>

                </p:panel>



                <p:panel rendered="#{bhtSummeryController.printPreview}">


                    <h:panelGrid columns="2">
                        <p:panel rendered="#{bhtSummeryController.patientEncounter.admissionType.admissionTypeEnum ne 'DayCase' and sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">                            
                            <h:panelGrid columns="1">
                                <p:commandButton value="Print Patient Copy" ajax="false">
                                    <p:printer target="claimablePatientCopy" ></p:printer>
                                </p:commandButton>                               
                                <p:commandButton value="Print Duplicate Copy" ajax="false" >
                                    <p:printer target="claimableDuplicate" ></p:printer>
                                </p:commandButton> 
                                <p:commandButton value="Check Intrim " ajax="false" action="inward_bill_intrim" actionListener="#{bhtSummeryController.prepareNewBill()}"  styleClass="noPrintButton" onclick="onSubmitButton();">
                                </p:commandButton>
                            </h:panelGrid>
                        </p:panel>
                        <p:panel rendered="#{bhtSummeryController.patientEncounter.admissionType.admissionTypeEnum ne 'DayCase' and sessionController.userPreference.applicationInstitution eq 'Ruhuna'}">                            
                            <h:panelGrid columns="1">
                                <p:commandButton value="Final Bill &amp; Profesional Bill" ajax="false"   >
                                    <p:printer target="professionalAndFinaBill" ></p:printer>
                                </p:commandButton> 
                                <p:commandButton value="Check Intrim " ajax="false" action="inward_bill_intrim" actionListener="#{bhtSummeryController.prepareNewBill()}"  styleClass="noPrintButton" onclick="onSubmitButton();">
                                </p:commandButton>
                            </h:panelGrid>
                        </p:panel>
                        <!--                        <p:panel header="Not Claimable" >
                                                    <h:panelGrid columns="1">
                                                        <p:commandButton value="Patient Copy without Professional" ajax="false" >
                                                            <p:printer target="notClaimablePatientCopy" ></p:printer>
                                                        </p:commandButton>                              
                                                        <p:commandButton value="Duplicate wihout Professional" ajax="false" >
                                                            <p:printer target="notClaimableDuplicate" ></p:printer>
                                                        </p:commandButton>  
                                                        <p:commandButton value="Professional Fees" ajax="false" >
                                                            <p:printer target="professional" ></p:printer>
                                                        </p:commandButton>
                                                    </h:panelGrid>
                                                </p:panel>-->
                        <p:panel header="CLAIMABLE" rendered="#{bhtSummeryController.patientEncounter.admissionType.admissionTypeEnum eq 'DayCase' and sessionController.userPreference.applicationInstitution eq 'Ruhuna'}">                            
                            <h:panelGrid columns="1">
                                <p:commandButton value="Green Sheet Print &amp; Professional Fees" ajax="false"   >
                                    <p:printer target="finalBillGreenSheetWithoutProAndProfsional" ></p:printer>
                                </p:commandButton>
                            </h:panelGrid>
                        </p:panel>
                        <p:panel header="CLAIMABLE" rendered="#{bhtSummeryController.patientEncounter.admissionType.admissionTypeEnum eq 'DayCase' and sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">                            
                            <h:panelGrid columns="1">
                                <p:commandButton ajax="false" value="Green Sheet Print" >
                                    <p:printer target="finalBillGreenSheet" ></p:printer>
                                </p:commandButton>
                            </h:panelGrid>
                        </p:panel>
                        <p:panel header="Not Claimable" rendered="#{bhtSummeryController.patientEncounter.admissionType.admissionTypeEnum eq 'DayCase' and sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">
                            <h:panelGrid columns="1">
                                <p:commandButton ajax="false" value="Green Sheet Print Without Professional"  >
                                    <p:printer target="finalBillGreenSheetWithoutPro" ></p:printer>
                                </p:commandButton>
                                <p:commandButton value="Professional Fees" ajax="false" >
                                    <p:printer target="professional" ></p:printer>
                                </p:commandButton>
                            </h:panelGrid>
                        </p:panel>
                    </h:panelGrid>

                    <h:panelGroup id="professionalAndFinaBill" styleClass="noBorder" 
                                  rendered="#{sessionController.userPreference.applicationInstitution eq 'Ruhuna'}"> 
                        <bi:finalBill  bill="#{bhtSummeryController.current}" hosCopy="true" />
                        <bi:finalProfessionalBill bill="#{bhtSummeryController.current}" hosCopy="true"  />
                        <bi:finalBill_1 bill="#{bhtSummeryController.current}" hosCopy="true"/>
                    </h:panelGroup>
                    <h:panelGroup id="finalBillGreenSheetWithoutProAndProfsional" styleClass="noBorder" rendered="#{sessionController.userPreference.applicationInstitution eq 'Ruhuna'}">                  
                        <bi:finalBillGreenSheet  bill="#{bhtSummeryController.current}" showProfessional="false"/>
                        <bi:finalProfessionalBill bill="#{bhtSummeryController.current}" />
                    </h:panelGroup>

                    <h:panelGroup id="claimablePatientCopy" styleClass="noBorder" rendered="#{sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">                  
                        <bi:finalBill   bill="#{bhtSummeryController.current}" showProfessional="true"/>
                    </h:panelGroup>

                    <h:panelGroup id="claimableDuplicate" styleClass="noBorder" rendered="#{sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">                    
                        <bi:finalBill duplicate="true"   showProfessional="true"                                
                                      bill="#{bhtSummeryController.current}" />
                    </h:panelGroup>

                    <h:panelGroup id="notClaimablePatientCopy" styleClass="noBorder" rendered="#{sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">
                        <bi:finalBill  bill="#{bhtSummeryController.current}" />
                    </h:panelGroup>

                    <h:panelGroup id="notClaimableDuplicate" styleClass="noBorder" rendered="#{sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">                
                        <bi:finalBill duplicate="true" bill="#{bhtSummeryController.current}" />
                    </h:panelGroup>



                    <h:panelGroup id="professional" styleClass="noBorder" rendered="#{sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">       
                        <bi:finalProfessionalBill bill="#{bhtSummeryController.current}"  />
                    </h:panelGroup>

                    <h:panelGroup id="finalBillGreenSheet" styleClass="noBorder" rendered="#{sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">                  
                        <bi:finalBillGreenSheet  bill="#{bhtSummeryController.current}" showProfessional="true"/>
                    </h:panelGroup>

                    <h:panelGroup id="finalBillGreenSheetWithoutPro" styleClass="noBorder" rendered="#{sessionController.userPreference.applicationInstitution ne 'Ruhuna'}">                  
                        <bi:finalBillGreenSheet  bill="#{bhtSummeryController.current}" />
                    </h:panelGroup>

                </p:panel>
            </h:form>

        </h:panelGroup>

    </ui:define>

</ui:composition>
